import { ElMessage } from "element-plus";
import router from "./router";
import { useUserStore } from "./stores/user";
const WHITE_LIST = ["/login",'404'];
router.beforeEach((to, from, next) => {
  const store = useUserStore()
  if (store.token) {
    next()
  }else{
    if(WHITE_LIST.includes(to.path)){
      next()
    }else{
      ElMessage.error('请先登录！')
      next('/login')
    }
  }
});